package io;


import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
//️🧡💛💚💙💜🤎🖤🤍❤️‍️🧡💛💚💙💜🤎🖤🤍❤️‍️🧡💛💚💙💜🤎🖤🤍❤
public class OSWDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos=new FileOutputStream("osw.txt");
        OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        //️🧡💛💚💙💜🤎🖤🤍❤️‍️🧡💛💚💙💜🤎🖤🤍❤️‍️🧡💛💚💙💜🤎🖤🤍❤
        //创建转换流时通常会指定第二个参数来明确字符集,以此来保证跨平台性
        osw.write("我和你猜了又猜♥");
        osw.write("还是分开♥");
        osw.close();//关闭高级流时,会自动关闭低级流
        System.out.println("写入完毕");
    }
}
